//
//  UserInfo.m
//  BCNADemo
//
//  Created by 马东朝 on 2018/5/18.
//  Copyright © 2018年 马东朝. All rights reserved.
//

#import "UserInfo.h"

@implementation UserInfo
static UserInfo *instance = nil;

+ (instancetype)sharedUserInfo
{
    return [[self alloc] init];
}

- (instancetype)init
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [super init];
        
        
        instance.userId = [NSMutableString stringWithCapacity:0];
        instance.unique_id = [NSMutableString stringWithCapacity:0];
        instance.email = [NSMutableString stringWithCapacity:0];
        instance.code = [NSMutableString stringWithCapacity:0];
        instance.phone = [NSMutableString stringWithCapacity:0];
        instance.expire_time = [NSMutableString stringWithCapacity:0];
        instance.create_time = [NSMutableString stringWithCapacity:0];
        instance.max_online = [NSMutableString stringWithCapacity:0];
        instance.is_expired = [NSMutableString stringWithCapacity:0];
        instance.client_ip = [NSMutableString stringWithCapacity:0];
        
    });
    return instance;
}

+ (instancetype)allocWithZone:(struct _NSZone *)zone
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [super allocWithZone:zone];
    });
    return instance;
}
- (void)setInfoWithJsonData:(NSDictionary *)jsonDic{
    /*
     {
     "code": 200,
     "msg": "",
     "data": {
     "user": {
    
     
     
     
     
     
     
     
     
     "client_ip": "127.0.0.1"
     }
     }
     }
     */
    NSDictionary *dataDic  = jsonDic[@"data"][@"user"];
    self.userId = [NSMutableString stringWithFormat:@"%@", dataDic[@"id"]];
    self.unique_id = [NSMutableString stringWithFormat:@"%@", dataDic[@"unique_id"]];
    self.email = [NSMutableString stringWithFormat:@"%@", dataDic[@"email"]];
    self.code = [NSMutableString stringWithFormat:@"%@", dataDic[@"code"]];
    self.phone = [NSMutableString stringWithFormat:@"%@", dataDic[@"phone"]];
    self.expire_time = [NSMutableString stringWithFormat:@"%@", dataDic[@"expire_time"]];
    self.create_time = [NSMutableString stringWithFormat:@"%@", dataDic[@"create_time"]];
    self.max_online = [NSMutableString stringWithFormat:@"%@", dataDic[@"max_online"]];
    self.is_expired = [NSMutableString stringWithFormat:@"%@", dataDic[@"is_expired"]];
    self.client_ip = [NSMutableString stringWithFormat:@"%@", dataDic[@"client_ip"]];
   
    
}
- (NSString *)description
{
    NSString *result = @"";
    
    return result;
}



@end
